#include<stdio.h>
#include<string.h>
#include<math.h>

#define MAX 110
int dirconnect[MAX][MAX];//????????最多
int dirconnection[MAX];//??????????
int connection[MAX];//????????????????????
int connect[MAX][MAX];//????????
int n,m;

double origingas[MAX];//????????????
double gas[MAX];
double pipegas[MAX];

int main()
{
	int t;
	int test,i,j,k;
	int a,b;

	scanf("%d",&t);
	for(test=1;test<=t;test++)
	{
		memset(dirconnect,0,sizeof(dirconnect));
		memset(connect,0,sizeof(connect));
		memset(connection,0,sizeof(connection));
		memset(dirconnection,0,sizeof(dirconnection));
		memset(gas,0,sizeof(gas));
		memset(pipegas,0,sizeof(pipegas));
		memset(origingas,0,sizeof(origingas));

		scanf("%d %d",&n,&m);
		for(i=1;i<=n;i++)
		{
			scanf("%lf",&origingas[i]);
		}

		for(i=1;i<=m;i++)
		{
			scanf("%d %d",&a,&b);
			dirconnect[a][b]=1;
			dirconnect[b][a]=1;
			connect[a][b]=1;
			connect[b][a]=1;
		}

		for(i=1;i<=n;i++)//caculate dirconnection[]
		{
			for(j=1;j<=n;j++)
			{
				if(dirconnect[i][j]==1)
					dirconnection[i]++;
			}
		}

		for(k=1;k<=n;k++)//creat connect[]
		{
			for(i=1;i<=n;i++)
			{
				for(j=1;j<=n;j++)
				{
					if(k!=i && k!=j && i!=j)
					{
						if(connect[i][k]==1 && connect[k][j]==1)
						{
							connect[i][j]=1; connect[j][i]=1;
						}
					}
				}
			}
		}

		for(k=1;k<=n;k++)//caculate connection[]
		{
			connection[k]+=dirconnection[k];
			for(i=1;i<=n-1;i++)
			{
				for(j=i+1;j<=n;j++)
				{
					if(connect[k][i]==1 && connect[k][j]==1)
					{
						if(dirconnect[i][j]==1)
							connection[k]++;
					}


				}
			}
		}

		for(i=1;i<=n;i++)//caculate gas[]
		{
			gas[i]+=origingas[i];
			for(j=1;j<=n;j++)
			{
				if(connect[i][j]==1)
				{
					gas[i]+=origingas[j];
				}
			}
		}

		for(i=1;i<=n;i++)//caculate pipegas[]
		{
			if(connection[i]==0)
				pipegas[i]=gas[i];
			else
				pipegas[i]=gas[i]/connection[i]/2;
		}


		if(test!=1)
			printf("\n");

		for(i=1;i<=n;i++)
		{
			if(dirconnection[i]==0)
				printf("%.3lf\n",pipegas[i]);
			else
				printf("%.3lf\n",pipegas[i]*dirconnection[i]);
		}


	}//end of for(test)
	return 0;
}

